<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui"
      xmlns:c="http://java.sun.com/jsp/jstl/core">

    <body>

        <ui:composition template="./productionReport.xhtml">

            <ui:define name="tabContent">
                <h:panelGrid columns="2">
                    <h:form>
                        Mạng
                        <p:selectManyCheckbox value="#{productionOfOperatorsBean.selectedDeliverProvider}">
                            <f:selectItem itemLabel="Mobifone" itemValue="smsgate_mobifone"/>
                            <f:selectItem itemLabel="Vinaphone" itemValue="smsgate_vinaphone"/>
                            <f:selectItem itemLabel="Viettel" itemValue="smsgate_viettel"/>
                        </p:selectManyCheckbox>

                        Thời gian bắt đầu
                        <p:calendar value="#{productionOfOperatorsBean.startTime}" pattern="dd/MM/yyyy HH:mm:ss" timeZone="Asia/Saigon" navigator="true"
                                    required="true" requiredMessage="Bạn chưa chọn thời gian bắt đầu" id="startTime"/>
                        Thời gian kết thúc
                        <p:calendar value="#{productionOfOperatorsBean.endTime}" pattern="dd/MM/yyyy HH:mm:ss" timeZone="Asia/Saigon" navigator="true"
                                    required="true" requiredMessage="Bạn chưa chọn thời gian bắt đầu" id="endTime"/>
                        <br/>
                        <p:commandButton update="tblReport startTime endTime" action="#{productionOfOperatorsBean.report()}" value="Xem báo cáo" onclick="processingDialog.show()"
                                         onsuccess="processingDialog.hide()"/>
                        <p:commandButton update="tblReport startTime endTime" action="#{productionOfOperatorsBean.reportOfToday()}" value="Xem hôm nay" onclick="processingDialog.show()"
                                         onsuccess="processingDialog.hide()"/>
                    </h:form>
                </h:panelGrid>

                <br/>

                <h:form id="tblReport">
                    <p:dataTable value="#{productionOfOperatorsBean.list}" var="item" resizableColumns="true">

                        <p:column headerText="Người vận hành" sortBy="#{item.username}">
                            #{item.username}
                        </p:column>
                        <p:column headerText="Sản lượng người vận hành">
                            <p:dataTable id="tblReportDetail" value="#{item.productionOfSyntax}" var="syntaxItem" >

                                <p:column headerText="Cú pháp" sortBy="#{syntaxItem.syntax}">
                                    #{syntaxItem.syntax}
                                </p:column>
                                <p:column headerText="Sản lượng" sortBy="#{syntaxItem.production}">
                                    #{syntaxItem.production}
                                </p:column>
                                <f:facet name="footer">  
                                    Tổng: #{item.totalProduction}
                                </f:facet>
                            </p:dataTable>
                        </p:column>

                    </p:dataTable>

                </h:form>
                <br/>


            </ui:define>

        </ui:composition>

    </body>
</html>
